#pragma once

#include "includeBase.h"
#include "../common/BasePclModel.h"

class PoseEstimationModel : public BasePclModel
{
public:
    PoseEstimationModel();

public:
    static PoseEstimationModel& get();

public: // IJsonSerializable
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    QJsonObject toJson() const override;

public: // Property
    QString pcdFile() const { return pcdFile_; }
    void setPcdFile(const QString& pcdFile) { pcdFile_ = pcdFile; }

    QString pcdFile2() const { return pcdFile2_; }
    void setPcdFile2(const QString& pcdFile2) { pcdFile2_ = pcdFile2; }

    double leafSize() const { return leafSize_; }
    void setLeafSize(double leafSize) { leafSize_ = leafSize; }

    double nestRadiusSearch() const { return nestRadiusSearch_; }
    void setNestRadiusSearch(double nestRadiusSearch) { nestRadiusSearch_ = nestRadiusSearch; }

    double festRadiusSearch() const { return festRadiusSearch_; }
    void setFestRadiusSearch(double festRadiusSearch) { festRadiusSearch_ = festRadiusSearch; }

    int alignMaximumIterations() const { return alignMaximumIterations_; }
    void setAlignMaximumIterations(int alignMaximumIterations) { alignMaximumIterations_ = alignMaximumIterations; }

    int alignNumberOfSamples() const { return alignNumberOfSamples_; }
    void setAlignNumberOfSamples(int alignNumberOfSamples) { alignNumberOfSamples_ = alignNumberOfSamples; }

    double alignCorrespondenceRandomness() const { return alignCorrespondenceRandomness_; }
    void setAlignCorrespondenceRandomness(double alignCorrespondenceRandomness)
    {
        alignCorrespondenceRandomness_ = alignCorrespondenceRandomness;
    }

    double alignSimilarityThreshold() const { return alignSimilarityThreshold_; }
    void setAlignSimilarityThreshold(double alignSimilarityThreshold)
    {
        alignSimilarityThreshold_ = alignSimilarityThreshold;
    }

    double alignMaxCorrespondenceDistance() const { return alignMaxCorrespondenceDistance_; }
    void setAlignMaxCorrespondenceDistance(double alignMaxCorrespondenceDistance)
    {
        alignMaxCorrespondenceDistance_ = alignMaxCorrespondenceDistance;
    }

    double alignInlierFraction() const { return alignInlierFraction_; }
    void setAlignInlierFraction(double alignInlierFraction) { alignInlierFraction_ = alignInlierFraction; }

    QColor sceneCloudPointColor() const { return sceneCloudPointColor_; }
    void setSceneCloudPointColor(const QColor& sceneCloudPointColor) { sceneCloudPointColor_ = sceneCloudPointColor; }

    int sceneCloudPointSize() const { return sceneCloudPointSize_; }
    void setSceneCloudPointSize(int sceneCloudPointSize) { sceneCloudPointSize_ = sceneCloudPointSize; }

    QColor objectAlignedCloudPointColor() const { return objectAlignedCloudPointColor_; }
    void setObjectAlignedCloudPointColor(const QColor& objectAlignedCloudPointColor)
    {
        objectAlignedCloudPointColor_ = objectAlignedCloudPointColor;
    }

    int objectAlignedCloudPointSize() const { return objectAlignedCloudPointSize_; }
    void setObjectAlignedCloudPointSize(int objectAlignedCloudPointSize)
    {
        objectAlignedCloudPointSize_ = objectAlignedCloudPointSize;
    }

private:
    QString pcdFile_ = "<pcl>/doc/tutorials/content/sources/alignment_prerejective/chef.pcd";
    QString pcdFile2_ = "<pcl>/doc/tutorials/content/sources/alignment_prerejective/rs1.pcd";

    double leafSize_ = 0.005;
    double nestRadiusSearch_ = 0.005;
    double festRadiusSearch_ = 0.025;
    int alignMaximumIterations_ = 50000;
    int alignNumberOfSamples_ = 2;
    int alignCorrespondenceRandomness_ = 5;
    double alignSimilarityThreshold_ = 0.95;
    double alignMaxCorrespondenceDistance_ = leafSize_ * 2.5;
    double alignInlierFraction_ = 0.25;

    QColor sceneCloudPointColor_ = Qt::green;
    int sceneCloudPointSize_ = 2;
    QColor objectAlignedCloudPointColor_ = Qt::blue;
    int objectAlignedCloudPointSize_ = 2;
};
